package com.hbnu.system.controller;

import com.hbnu.system.core.base.Rest;
import com.hbnu.system.model.entity.Art_Qualification;
import com.hbnu.system.service.IArtQualificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/artqulification")
@Api(tags = "艺体量化模块")
public class ArtQualificationController {
    @Autowired
    private IArtQualificationService iArtQualificationService;

    @ApiOperation("艺体量化添加")
    @PostMapping("/addArtQualification")
    public Rest<Boolean> addArtQualification(@RequestBody Art_Qualification art_qualification){
        boolean add = iArtQualificationService.addArt_Qualification(art_qualification);
        return add ? Rest.success() : Rest.failed();
    }

    @ApiOperation("艺体量化删除")
    @GetMapping("/deleteArtQulification")
    public Rest<Boolean> deleteArtQulification(String ArtQualificationID){
        boolean delete = iArtQualificationService.deleteArt_Qualification(ArtQualificationID);
        return delete ? Rest.success() : Rest.failed();
    }

    @ApiOperation("艺体量化查看")
    @GetMapping("/getArtQulification")
    public Rest<List<Art_Qualification>> getArtQulification(String ArtID){
        List<Art_Qualification> oneArt_qualification = iArtQualificationService.getOneArt_Qualification(ArtID);

        return Rest.success(oneArt_qualification);
    }

    @ApiOperation("校级管理员修改量化分数")
    @PostMapping("/upArtScore")
    public Rest<Boolean> upAwardScore(@RequestBody Art_Qualification art_qualification ){
        boolean update = iArtQualificationService.upArtScore(art_qualification);
        return update ? Rest.success() : Rest.failed();
    }
}
